VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} formCotyBatch 
   Caption         =   "Coty Batch Process"
   ClientHeight    =   4200
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   9750
   OleObjectBlob   =   "formCotyBatch.frx":0000
   ShowModal       =   0   'False
   StartUpPosition =   1  'CenterOwner
End
Attribute VB_Name = "formCotyBatch"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


'Project Name:  Array
'Host Name:     Array.formcotybatch
'Date:
'Version:
'Revised by:    Joseph Weir

' Cafe CotyBatch from FXI using Package.SendToScreen, Cafe.Screen.Process and Timer.
'
' 2004-08-25, JFW, Initial version.
' 2005-12-09, JFW, Code review.

Option Explicit

Dim m_fcilPackageXML As FedExCanada.PackageXML

Dim m_objFCIL_TD As FedExCanada.TD

Dim WithEvents timerTDB As Timer
Attribute timerTDB.VB_VarHelpID = -1
Dim WithEvents timerTest As Timer
Attribute timerTest.VB_VarHelpID = -1

Dim m_lngCount As Long
Dim m_lngCountError As Long

Dim m_colBatchRecords As Collection
Dim m_objBatchRecord As classBatchRecord
Dim m_colBatchHeader As Collection
' 2007-05-09, JFW, Accomodate new file format with new field
Dim m_lngFieldCount As Long
'




'
' Ship and return from Cafe Passport
'
Private Function BatchShipNext(Optional ContainerID As Long = 0) As Boolean

    On Error GoTo ErrorExit
    
    Dim i As Long
    Dim j As Long
    Dim strTrackingNumber As String
    Dim strFreightCharge As String
    Dim strError As String
    Dim strTransIn As String
    Dim strTransOut As String
    
    Dim objPackage As Package

    strError = "Package"
    If ContainerID = 0 Then
        Set objPackage = CafePackage(m_colBatchRecords.Item(m_lngCount))
        Me.textStatus = "Processing " & m_lngCount & " of " & m_colBatchRecords.Count & ", " & m_lngCountError & " in error." _
            & vbCrLf & objPackage.Recipient.Company & ", " & objPackage.Recipient.City & "."
    Else
        Set objPackage = CafePackage(m_colBatchRecords.Item(ContainerID))
        Me.textStatus = "Processing container ID " & m_colBatchRecords.Item(ContainerID).Item("ContainerID") & ", " & m_lngCountError & " in error." _
            & vbCrLf & objPackage.Recipient.Company & ", " & objPackage.Recipient.City & "."
    End If
        
    If Me.checkTD And objPackage.Recipient.Country = "US" Then
        strError = "FedExCanada"
        If m_objFCIL_TD Is Nothing Then
            Set m_objFCIL_TD = New FedExCanada.TD
        End If
        strError = "UseCurrentMaster"
        If m_objFCIL_TD.UseCurrentMaster <> "" Then
            ' 2011-01-31, JFW, Get CI flag from master.
            objPackage.Intl.IncludeCommercialInvoice = m_objFCIL_TD.MasterShipmentCI
            
            ' 2011-01-31, JFW, Get CI flag from master.
            ' m_objShipment.Package.Intl.IncludeCommercialInvoice = m_objFCIL_TD.MasterShipmentCI
            ' 2011-06-24, JFW, Allow Future date.
            objPackage.SpecialServices.FutureShipment.ShipDate = m_objFCIL_TD.MasterShipmentPickupDate
            
            On Error GoTo ErrorFCILReturnAddress
            With m_objFCIL_TD.MasterShipmentReturnAddress
                objPackage.ReturnAddress.Address1 = .Item("Address1").Item("Value")
                objPackage.ReturnAddress.Address2 = .Item("Address2").Item("Value")
                objPackage.ReturnAddress.City = .Item("City").Item("Value")
                objPackage.ReturnAddress.Company = .Item("Company").Item("Value")
                objPackage.ReturnAddress.Contact = .Item("Contact").Item("Value")
                objPackage.ReturnAddress.Phone = .Item("Phone").Item("Value")
                objPackage.ReturnAddress.State = .Item("State").Item("Value")
                objPackage.ReturnAddress.Zip = .Item("Zip").Item("Value")
            End With
            On Error GoTo ErrorExit
            ' Specific for Array
            objPackage.ID = Right(m_colBatchRecords(m_lngCount).Item("ContainerID"), 12)
            '
            On Error GoTo ProcessContinue
            objPackage.Process
            '
        Else
            Err.Raise 12345, "FCIL.UseCurrentMaster", "Current TD Master shipment cannot be determined.  See the TD Dashboard."
        End If
    Else
        On Error GoTo ProcessContinue
        objPackage.Process
    End If
    
ProcessContinue:
    If Err.Number <> 0 Then
        strTrackingNumber = Err.Source & ", " & Err.Description
        m_lngCountError = m_lngCountError + 1
        strError = "RecordError"
        Call RecordError(m_colBatchRecords(m_lngCount).Item("Record"), strTrackingNumber)
        ' 2011-08-12, JFW, ETD upload failure.
        Call PrintErrorLabel(objPackage, strTrackingNumber)
        strTrackingNumber = ""
    ElseIf objPackage.TrackNo <> "" Then
        strFreightCharge = ""
        strTrackingNumber = ""
        strTrackingNumber = objPackage.TrackNo
        strFreightCharge = objPackage.Charges.CustomerRates.NetCharge
    Else
        Err.Raise 12345, "BatchShipNext.Process", "indeterminate transaction output.  No tracking number and no error message.  "
    End If
    If strTrackingNumber <> "" Then
        strError = "ODBC_Insert"
        ' 2010-04-22, JFW, Found this commented out!
        Call ODBC1.ODBC_Insert(strTrackingNumber)
        ' 2009-07-21, JFW
        ' Logfile "formCotyBatch.BatchShipNext, Calling Cafe1.AfterShipment, tracking number " & strTrackingNumber
        Call Cafe1.AfterShipment(strTrackingNumber)
    End If
    BatchShipNext = True
    Exit Function
    
ErrorFCIL:
    Err.Raise 12345, "CotyBatch.BatchShipNext", "Error at TDPiece - Cannot access FCIL - Please report this to FedEx technical support.  " & Err.Source & " - " & Err.Description _
        , vbApplicationModal + vbSystemModal + vbExclamation
    Exit Function
ErrorFCILCurrentMaster:
    Err.Raise 12345, "CotyBatch.BatchShipNext", "Error at TDPiece - Cannot access current master shipment.  Check the TD dashboard.  " & Err.Source & " - " & Err.Description _
        , vbApplicationModal + vbSystemModal + vbExclamation
    Exit Function
ErrorFCILReturnAddress:
    Err.Raise 12345, "CotyBatch.BatchShipNext", "Error at TDPiece - Cannot access master shipment return address - Please report this to FedEx technical support.  " & Err.Source & " - " & Err.Description _
        , vbApplicationModal + vbSystemModal + vbExclamation
    Exit Function
ErrorProcess:
    Err.Raise 12345, "CotyBatch.BatchShipNext", "Error at Process, " & strError & ", " & Err.Description
    Window.Minimize Window.SetTopMost(Me)
    Exit Function
ErrorExit:
    Err.Raise 12345, "CotyBatch.BatchShipNext", "Error at " & strError & ", " & Err.Description
    If False Then
        Resume
    End If
    
End Function
'


Private Function CafePackage(objBatchRecord As classBatchRecord) As Package

    On Error GoTo ErrorExit
    
    Dim objPackage As Package
    Dim objDims As Object
    Dim objIntl As Intl
    
    Set objPackage = New Package
    Set objIntl = objPackage.Intl
    
    objPackage.Recipient.Company = StringNullToBlank(objBatchRecord.Item("COMP_NAME"))
    objPackage.Recipient.Address1 = StringNullToBlank(objBatchRecord.Item("ADDR_1"))
    objPackage.Recipient.Address2 = StringNullToBlank(objBatchRecord.Item("ADDR_2"))
    objPackage.Recipient.City = StringNullToBlank(objBatchRecord.Item("CITY"))
    objPackage.Recipient.State = Trim(objBatchRecord.Item("PROVINCE"))
    If objBatchRecord.Item("CountryCode") = "US" Then
        If Len(Trim(objBatchRecord.Item("POST_CODE"))) <= 5 Then
            objPackage.Recipient.Zip = Right("00000" & Trim(objBatchRecord.Item("POST_CODE")), 5)
        Else
            objPackage.Recipient.Zip = Right("000000000" & Trim(objBatchRecord.Item("POST_CODE")), 9)
        End If
    Else
        objPackage.Recipient.Zip = Replace(Trim(objBatchRecord.Item("POST_CODE")), " ", "")
    End If
    objPackage.Recipient.Phone = "9198955350"
    objPackage.Recipient.Country = objBatchRecord.Item("CountryCode")
    
    objPackage.PackageType = objBatchRecord.Item("PackageCode")
    If comboService.Value & "" <> "" Then
        objPackage.ServiceType = ServiceCafeToFXI(comboService.Value)
    Else
        objPackage.ServiceType = objBatchRecord.Item("ServiceCode")
    End If
    objPackage.Weight = CDbl(objBatchRecord.Item("Weight"))
    objPackage.WeightType = IIf(UCase(objBatchRecord.Item("WeightType")) = "KGS", fsmKG, fsmLbs)
    
    If objPackage.Recipient.Country = "US" Then
        objPackage.Intl.UltimateDestination = objPackage.Recipient.Country
        With objPackage.Intl
            .PackageType = fsmFedEx_Intl_Box
            .UltimateDestination = objPackage.Recipient.Country
            .CurrencyType = objBatchRecord.Item("CurrencyType")
            .TermsOfSale = objBatchRecord.Item("TermsOfSale")
            .DutyTaxPayType = objBatchRecord.Item("DTPaymentType")
            .DutyTaxAcctNo = objBatchRecord.Item("DTPaymentAccount")
            .PartiesRelated = False
        End With
    End If
    
    objPackage.PurchaseOrder = StringNullToBlank(objBatchRecord.Item("ContainerID"))
    objPackage.Invoice = StringNullToBlank(objBatchRecord.Item("ProductCode"))
    objPackage.Reference = StringNullToBlank(objBatchRecord.Item("COMP_NAME"))
    
    objPackage.SpecialServices.DeclaredValue = 0
    ' 2011-12-20, JFW, Per Nas
    objPackage.PaymentType = fsmBill_Sender
    '    objPackage.PaymentType = objBatchRecord.Item("PaymentType")
    ' objPackage.PaymentType = fsmBill_3rd_Party
    '    objPackage.Recipient.AccountNo = objBatchRecord.Item("PaymentAccount")
    ' objPackage.Recipient.AccountNo = "219336381"
    
    If objPackage.Recipient.Country <> "CA" Then
    
        With objPackage.Intl.Commodities.Add
            .Description = StringNullToBlank(objBatchRecord.Item("Description"))
            If textCmdtyDescription <> "" Then
                .Description = textCmdtyDescription
            End If
            .UnitQuantity = objBatchRecord.Item("Quantity")
            .UnitOfMeasure = objBatchRecord.Item("UnitOfMeasure")
            .UnitValue = objBatchRecord.Item("UnitPrice")
            If IsNumeric(textCmdtyValue) Then
                .UnitValue = Val(textCmdtyValue)
            End If
            .Weight = objBatchRecord.Item("Weight")
            .CountryOfMfg = objBatchRecord.Item("CountryOfMfg")
            If Trim(StringNullToBlank(objBatchRecord.Item("HSCode"))) <> "" _
            And LCase(Trim(StringNullToBlank(objBatchRecord.Item("HSCode")))) <> "unknown" Then
                .HarmonizedCode = Trim(StringNullToBlank(objBatchRecord.Item("HSCode")))
            End If
            .PartNumber = StringNullToBlank(objBatchRecord.Item("ProductCode"))
        End With
    
        If Me.checkTD.Value And objPackage.Recipient.Country = "US" Then
            objPackage.Intl.IncludeTD = True
        ElseIf objPackage.Recipient.Country <> "CA" Then
            With objPackage.Intl
                .IncludeTD = False
                .UploadTradeDocumentsFlag = True
                .IncludeCommercialInvoice = True
                If .Commodities.Count <= 0 Then
                    With .CommercialInvoice
                        .InvoiceType = fsmCommercialInvoice
                        .Copies = 0
                        .InvoicePurpose = fsmSold
                    End With
                ElseIf False Then
                    With .CommercialInvoice
                        .InvoiceType = fsmCommercialInvoice
                        .Copies = 1
                        .InvoicePurpose = fsmSold
                    End With
                Else
                    With .CommercialInvoice
                        .InvoiceType = fsmMyOwnCommercialInvoice
                        .Copies = 0
                        .InvoicePurpose = fsmSold
                        .InvoicePath = Cafe4.CreatePackageCI(objPackage)
                    End With
                End If
            End With
        End If
    
    End If
    
    Set CafePackage = objPackage
    
    Exit Function
    
ErrorExit:
    Dim strError As String
    strError = Err.Source & " - " & Err.Description
    m_lngCountError = m_lngCountError + 1
    Call RecordError(m_colBatchRecords(m_lngCount).Item("Record"), strError)
    Exit Function
    Resume
End Function
'


Public Function FileHeader() As Collection

    On Error GoTo ErrorExit

    Set FileHeader = New Collection
    
    FileHeader.Add "ContainerID"
    FileHeader.Add "COMP_NAME"
    FileHeader.Add "ADDR_1"
    FileHeader.Add "ADDR_2"
    FileHeader.Add "CITY"
    FileHeader.Add "PROVINCE"
    FileHeader.Add "POST_CODE"
    FileHeader.Add "CountryCode"
    FileHeader.Add "PackageCount"
    FileHeader.Add "Weight"
    FileHeader.Add "PackageWeight"
    FileHeader.Add "WeightType"
    FileHeader.Add "PackageCode"
    FileHeader.Add "ServiceCode"
    ' 2007-05-09, JFW, Accomodate new file format with new field
    If m_lngFieldCount = 30 Then
        ' 2007-05-09, JFW, New file layout from Coty
        FileHeader.Add "Filler1"
    End If
    ' Layout continues
    FileHeader.Add "PaymentType"
    FileHeader.Add "PaymentAccount"
    FileHeader.Add "CurrencyType"
    FileHeader.Add "DTPaymentType"
    FileHeader.Add "DTPaymentAccount"
    FileHeader.Add "TermsOfSale"
    FileHeader.Add "CountryCode2"
    FileHeader.Add "ContainerID2"
    FileHeader.Add "CIFlag"
    FileHeader.Add "ProductCode"
    FileHeader.Add "CountryOfMfg"
    FileHeader.Add "Quantity"
    FileHeader.Add "HSCode"
    FileHeader.Add "UnitOfMeasure"
    FileHeader.Add "CommodityWeight"
    FileHeader.Add "UnitPrice"
    
    Exit Function
    
ErrorExit:
    Err.Raise 12345, "FileHeader", Err.Source & " - " & Err.Description
    
End Function

'---------------------------------------------------------------------------------------
' FileImport
' DateTime  : 08/03/2004
' Purpose   : Get import data
'---------------------------------------------------------------------------------------
'
Public Function FileImport(ImportFileName As String) As Boolean

    Dim strLine As String
    
    On Error GoTo ErrorExit

    Dim intImportFile As Long
    
    intImportFile = FreeFile
    Open ImportFileName For Input Access Read Shared As #intImportFile
    
    ' Header line supplied ...
    ' Line Input #intImportFile, strLine
    ' If EOF(intImportFile) Then Err.Raise 12345, "TDBatch.FileImport", "Empty input file, " & ImportFileName
    ' Set m_colBatchHeader = SplitLine(strLine, ",")
    
    Set m_colBatchHeader = FileHeader
    
    ' If EOF(intImportFile) Then Err.Raise 12345, "TDBatch.FileImport", "Empty input file, " & ImportFileName
    
    Do Until EOF(intImportFile)
        Line Input #intImportFile, strLine
        On Error Resume Next
        
        ' 2007-05-09, JFW, Accomodate new file format with new field
        m_lngFieldCount = UBound(Split(strLine, ","))
        If m_lngFieldCount = 30 Then
            Set m_colBatchHeader = FileHeader
        End If
        
        Set m_objBatchRecord = SplitLine(strLine, ",", m_colBatchHeader)
        
        If Err.Number = 0 Then
            On Error GoTo ErrorExit
            If m_colBatchRecords.Count = 0 _
            And Not IsNumeric(m_objBatchRecord.Item("ContainerID")) Then
                ' Header row
            Else
                m_colBatchRecords.Add m_objBatchRecord, m_objBatchRecord.Item("ContainerID")
            End If
        Else
            Err.Clear
            On Error GoTo ErrorExit
            m_lngCountError = m_lngCountError + 1
            Call RecordError(strLine, "Can't match record to columns.")
        End If
        
    Loop

    FileImport = True
    
Release:
    Close #intImportFile
    Exit Function

ErrorExit:

    MsgBox Err.Description & " (RecordImport)", vbApplicationModal + vbSystemModal
    ' FileImport = False
    Resume Release

End Function
'



Public Sub RecordError(RecordText As String, Problem As String)

    On Error GoTo EH
    
    Dim strOutFile As String
    
    Dim intFile As Integer
    Dim strInsert As String
    
    strOutFile = g_formCotyBatch.textFilename
    strOutFile = Replace(strOutFile, ".csv", " Err.csv")
           
    intFile = FreeFile
    
    'Setting the insert information
    strInsert = RecordText & "," & Problem
    
    Open strOutFile For Append As #intFile

    Print #intFile, strInsert

    Close #intFile

    Exit Sub

EH:
    MsgBox Err.Description, vbApplicationModal + vbSystemModal, Me.Name & ".RecordError"
End Sub



Public Function ServiceCafeToFXI(ServiceCode As String) As String

    Select Case ServiceCode
    Case "1"
        ServiceCafeToFXI = "01"
    Case "2"
        ServiceCafeToFXI = "05"
    Case "3"
        ServiceCafeToFXI = "03"
    Case "4"
        ServiceCafeToFXI = "70"
    Case "5"
        ServiceCafeToFXI = "80"
    Case "6"
        ServiceCafeToFXI = "06"
    Case "7"
        ServiceCafeToFXI = "20"
    Case "8"
        ServiceCafeToFXI = "83"
    Case "H"
        ServiceCafeToFXI = "90"
    Case "R"
        ServiceCafeToFXI = "92"
    Case Else
        ServiceCafeToFXI = "01"
    End Select
    
End Function



'---------------------------------------------------------------------------------------
' Procedure : SplitLine
' DateTime  : 08/03/2004
' Purpose   : Parses out a delimited string and returns values in an array
'---------------------------------------------------------------------------------------
'
Public Function SplitLine(strLine As String, _
    Optional strDelimiter As String = ",", _
    Optional Heading As Collection) As classBatchRecord

    On Error GoTo SplitLine_Error

    Dim a As Long
    Dim b As Long
    Dim strCharacter As String
    Dim blnInQualifier As Boolean
    Dim aRecord As classBatchRecord

    Set aRecord = New classBatchRecord
    
    b = 1
    
    ' Search line by character to determine where the delimiter is _
    and if the delimiter is inside a qualifier, then assign _
    the field to the array
    
    For a = 1 To Len(strLine)
        
        strCharacter = Mid(strLine, a, Len(strDelimiter))
        Select Case True
            Case strCharacter = strDelimiter
                If Not blnInQualifier Then
                    b = b + 1
                    a = a + (Len(strDelimiter) - 1)
                    aRecord.Item(Heading.Item(b)) = ""
                Else
                    If Heading Is Nothing Then
                        aRecord.Item(b) = aRecord.Item(b) & Left(strCharacter, 1)
                    Else
                        aRecord.Item(Heading.Item(b)) = aRecord.Item(Heading.Item(b)) & Left(strCharacter, 1)
                    End If
                End If
            Case Left(strCharacter, 1) = Chr(34)
                blnInQualifier = Not blnInQualifier
            Case Else
                If Heading Is Nothing Then
                    aRecord.Item(b) = aRecord.Item(b) & Left(strCharacter, 1)
                Else
                    aRecord.Item(Heading.Item(b)) = aRecord.Item(Heading.Item(b)) & Left(strCharacter, 1)
                End If
        End Select
    Next a

    aRecord.Item("Record") = strLine
    
    Set SplitLine = aRecord

    Exit Function

SplitLine_Error:
    Err.Raise 12345, "Split.SplitLine", Err.Source & " - " & Err.Description
    Resume
    
End Function


Public Sub StopTD()

    ' On Error Resume Next
    
    timerTDB.Enabled = False
    Set g_formCotyBatch = Nothing
    Unload Me
    
End Sub


Private Sub buttonBrowse_Click()

    cdlSave.FileName = "*.csv"
    cdlSave.Filter = "Text Data (Comma Separated Values) (*.csv)|*.csv|"
    cdlSave.ShowOpen
    
    textFilename = cdlSave.FileName
    
End Sub


Private Sub buttonShipAll_Click()

    If textFilename = "" Then Exit Sub
    
    Set m_colBatchRecords = New Collection
    Set m_colBatchHeader = New Collection
    
    If FileImport(textFilename) Then
        m_lngCount = 0
        If timerTDB Is Nothing Then Set timerTDB = New Timer
        timerTDB.Interval = 500
        timerTDB.Enabled = True
        Cafe1.g_boolAfterLabel = True
    End If
    
    Exit Sub
    
ErrorExit:
    MsgBox "Error - " & Err.Source & " - " & Err.Description, vbApplicationModal + vbSystemModal
    
End Sub


Private Sub buttonShipOne_Click()

    On Error GoTo ErrorExit
    Dim strError As String
    
    If textFilename = "" Then Exit Sub
    If textContainerID = "" Then Exit Sub
    
    Set m_colBatchRecords = New Collection
    Set m_colBatchHeader = New Collection
    
    If FileImport(textFilename) Then
    
        If textContainerID <> "" Then
            m_lngCount = 0
            For Each m_objBatchRecord In m_colBatchRecords
                m_lngCount = m_lngCount + 1
                Set m_objBatchRecord = m_colBatchRecords(m_lngCount)
                If Right(m_objBatchRecord.Item("ContainerID"), Len(textContainerID)) = textContainerID Then Exit For
            Next m_objBatchRecord
        End If
        
        If BatchShipNext(m_lngCount) Then
            ' OK nothing here
        Else
            m_lngCountError = m_lngCountError + 1
            Call RecordError(m_colBatchRecords(textContainerID).Item("Record"), "Error")
        End If
    End If
    
    Exit Sub
    
ErrorExit:
    strError = Err.Source & " - " & Err.Description
    MsgBox "Error on shipment, container ID " & textContainerID & ", " & strError
    
End Sub
'


Private Sub timerTDB_Execute()

    On Error GoTo ErrorExit
    Dim strError As String
    
    ' Logfile "CotyBatch.timerTDB_Execute, AfterLabel " & Cafe1.g_boolAfterLabel
    
    If Cafe1.g_boolAfterLabel _
    Or Now > DateAdd("s", 25, g_dtAfterShipment) Then
        g_dtAfterShipment = Now
        Cafe1.g_boolAfterLabel = False
        
        m_lngCount = m_lngCount + 1
    
        If m_lngCount > m_colBatchRecords.Count Then
            timerTDB.Enabled = False
            Me.textStatus = "Complete " & m_colBatchRecords.Count & " records, " & m_lngCountError & " in error."
            Exit Sub
        End If
    
        Set m_objBatchRecord = m_colBatchRecords(m_lngCount)
        
        If BatchShipNext Then
            ' OK nothing here
        Else
            m_lngCountError = m_lngCountError + 1
            Call RecordError(CStr(m_objBatchRecord.Item("Record")), "Error")
        End If
        
    End If
    
    Exit Sub
    
ErrorExit:
    strError = Err.Source & " - " & Err.Description
    m_lngCountError = m_lngCountError + 1
    Call RecordError(CStr(m_objBatchRecord.Item("Record")), strError)
    
End Sub

Private Sub timerTest_Execute()

    timerTest.Enabled = False
    
    checkTD.Value = False
    ' textFilename.Text = "C:\Program Files\FedEx\Integration\Projects\Array\P19072 R CLARINS.xls"
    
    checkTD.Value = True
    textFilename.Text = "C:\Program Files\FedEx\Integration\Projects\Array\fdx20060623130300.csv"
    
    ' Call buttonShipAll_Click

End Sub

Private Sub UserForm_Initialize()
    
    Dim i As Long
    
    Dim objReg As FSIX.IRegistry
    Set objReg = New FSIX.IRegistry
    
    checkTD.Value = True
    
    comboService.AddItem "Priority Overnight"
    comboService.List(comboService.ListCount - 1, 1) = "1"
    comboService.AddItem "Standard Overnight"
    comboService.List(comboService.ListCount - 1, 1) = "2"
    comboService.AddItem "Economy 2Day"
    comboService.List(comboService.ListCount - 1, 1) = "3"
    comboService.AddItem "Freight - 1day"
    comboService.List(comboService.ListCount - 1, 1) = "4"
    comboService.AddItem "Freight - 2day"
    comboService.List(comboService.ListCount - 1, 1) = "5"
    comboService.AddItem "First Overnight"
    comboService.List(comboService.ListCount - 1, 1) = "6"
    comboService.AddItem "Express Saver"
    comboService.List(comboService.ListCount - 1, 1) = "7"
    comboService.AddItem "Freight - 3day"
    comboService.List(comboService.ListCount - 1, 1) = "8"
    comboService.AddItem "Ground"
    comboService.List(comboService.ListCount - 1, 1) = "R"
    
    comboService.Value = "R"
    
    If Windows.ComputerName = "CAN-00278478" Then
        Set timerTest = New Timer
        timerTest.Interval = 1000
        timerTest.Enabled = True
    End If
    
    ' frameHoldEdit.Visible = False
    
    ' Me.Left = objReg.GetValue(fsiDefault, "HoldFileList", "Left")
    ' Me.Top = objReg.GetValue(fsiDefault, "HoldFileList", "Top")
    
    ' 2011-12-20, JFW, Per Nas
    If Cafe1.Screen.GetSender.AccountNo <> "343955669" Then
        MsgBox "Coty processing should be on account 343955669.  Change FSM meter or process on account " & Cafe1.Screen.GetSender.AccountNo & ".", vbApplicationModal + vbSystemModal
    End If
    
End Sub

Private Sub UserForm_Terminate()

    On Error Resume Next
    
    Dim objReg As FSIX.IRegistry
    Set objReg = New FSIX.IRegistry

    Set g_formCotyBatch = Nothing
    
    ' objReg.SaveValue "HoldFileList", "Left", Me.Left
    ' objReg.SaveValue "HoldFileList", "Top", Me.Top

End Sub

